$(document).ready(function() { 
	$.validator.addMethod('lessThanEqual', function(value, element, param) {
		if (this.optional(element)) return true;
	    var i = parseFloat(value);
	    var j = parseFloat($(param).val());
	    return i <= j;
	}, "The value must be less than the Balance");

	
	// Validate Part1
	$("#frmTransferMoneyCustomer").validate({
		rules: {
			"customerBalanceInfo.transferAmount": {
				required: true,
				number: true,
				lessThanEqual: "#frmTransferMoneyCustomer_balanceAmount"
			},
			"customerBalanceInfo.toCustomerId": {
				required: true
			}		
		},
		messages: {
			"customerBalanceInfo.transferAmount": {
				required: "Amount is required",
				number:  "Please enter a valid amount"
			},
			"customerBalanceInfo.toCustomerId": {
				required: "Customer Id is required"
			}
		}
	});	
}); 
